<template>
  <view style="padding-top: 100rpx; padding: 40rpx;">
    <view class="text-area">
      <text>输入值：</text>
      <input type="text" v-model="title" style="color: red; border: 1px solid #ccc; padding: 5rpx;" />
    </view>
    <view class="text-area" style="margin-top: 20rpx;">
      <text>回传值：</text>
      <input type="text" :value="callBackValue" style="color: yellow; border: 1px solid #ccc; padding: 5rpx;" />
    </view>
    <comA :intent="title" style="margin-top: 30rpx;"></comA>
    <comB @callBackFun="callBack" style="margin-top: 30rpx;"></comB>
  </view>
</template>

<script>
import comA from '../../../components/comA.vue'
import comB from '../../../components/comB.vue'

export default {
  components: {
    comA,
    comB
  },
  data() {
    return {
      title: '',  // 必须初始化输入值变量
      callBackValue: ''  // 必须初始化回传值变量
    }
  },
  methods: {
    callBack(msg) {
      this.callBackValue = msg;  // 确保正确接收并更新回传值
    }
  }
}
</script>

<style>
.text-area {
  display: flex;
  align-items: center;
  gap: 10rpx;
}
</style>